//
//  UserEditCardCell.m
//  CheekiOS
//
//  Created by mac on 2017/6/20.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "UserEditCardCell.h"

@interface UserEditCardCell ()


@property (nonatomic, strong) UILabel *bgLinlab;
@property (nonatomic, strong) UILabel *promptLab;

@property (nonatomic, strong) UIImageView *imageBtn;
@property (nonatomic, strong) UIImageView *arrowImg;
@property (nonatomic, strong) UIImageView *cardImg;

@property (nonatomic, strong) UILabel *requirementsLab;
@property (nonatomic, strong) UILabel *oneLab;
@property (nonatomic, strong) UILabel *twoLab;
@property (nonatomic, strong) UILabel *threeLab;

@property (nonatomic, assign) NSIndexPath *indexPath;

@end

@implementation UserEditCardCell



+ (instancetype)cellWithTableView:(UITableView *)tableView indexPath:(NSIndexPath*)indexPath {
    static NSString *UserEditCardCellIdent = @"UserEditCardCellIdent";
    UserEditCardCell *cell = [tableView dequeueReusableCellWithIdentifier:UserEditCardCellIdent];
    if (!cell) {
        cell = [[UserEditCardCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:UserEditCardCellIdent];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    cell.indexPath = [NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section];
    
    return cell;
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        _bgLinlab = [[UILabel alloc] init];
        _bgLinlab.backgroundColor = RGB(246, 246, 246);
        [self addSubview:_bgLinlab];
        
        _promptLab = [[UILabel alloc] init];
        _promptLab.font = FontP(15);
        _promptLab.textAlignment = NSTextAlignmentLeft;
        _promptLab.textColor = [UIColor blackColor];
        [self addSubview:_promptLab];
        
        _imageBtn = [[UIImageView alloc] init];
        _imageBtn.contentMode = UIViewContentModeScaleToFill;

        [self addSubview:_imageBtn];
        
        _arrowImg = [[UIImageView alloc] init];
        [self addSubview:_arrowImg];
        
        _cardImg = [[UIImageView alloc] init];
        _cardImg.contentMode = UIViewContentModeScaleToFill;
        [self addSubview:_cardImg];
        
        
        _requirementsLab = [[UILabel alloc] init];
        _requirementsLab.font = FontP(12);
        _requirementsLab.textAlignment = NSTextAlignmentLeft;
        _requirementsLab.textColor = [UIColor blackColor];
        [self addSubview:_requirementsLab];
        
        _oneLab = [[UILabel alloc] init];
        _oneLab.font = FontP(12);
        _oneLab.textAlignment = NSTextAlignmentLeft;
        _oneLab.textColor = RGB(173, 173, 173);
        [self addSubview:_oneLab];
        
        _twoLab = [[UILabel alloc] init];
        _twoLab.font = FontP(12);
        _twoLab.textAlignment = NSTextAlignmentLeft;
        _twoLab.textColor = RGB(173, 173, 173);
        [self addSubview:_twoLab];
        
        _threeLab = [[UILabel alloc] init];
        _threeLab.font = FontP(12);
        _threeLab.textAlignment = NSTextAlignmentLeft;
        _threeLab.textColor = RGB(173, 173, 173);
        [self addSubview:_threeLab];
     
        
    }
    return self;
}

- (void)layoutSubviews{
    [super layoutSubviews];
    _bgLinlab.frame = CGRectMake(0, 0, KScreenWidth, 10);
    _promptLab.frame = CGRectMake(15, _bgLinlab.bottom, KScreenWidth-15, 55);
    _imageBtn.frame = CGRectMake(15, _promptLab.bottom+20, KScreenWidth/2-30-15-10, 100);
    _arrowImg.frame = CGRectMake(_imageBtn.right+20, _imageBtn.centerY-10, 25, 20);
    _cardImg.frame = CGRectMake(_arrowImg.right+40, _imageBtn.y, KScreenWidth/2-40-15-10, 100);
    
    _requirementsLab.frame = CGRectMake(15, _imageBtn.bottom+20, KScreenWidth, 20);
    _oneLab.frame = CGRectMake(15, _requirementsLab.bottom+5, KScreenWidth, 20);
    _twoLab.frame = CGRectMake(15, _oneLab.bottom+5, KScreenWidth, 20);
    _threeLab.frame = CGRectMake(15, _twoLab.bottom+5, KScreenWidth, 20);
    
    if (_imageStr != nil) {
        _imageBtn.image = _imageStr;

    }else{
        _imageBtn.image = [UIImage imageNamed:@"p_center_smrz_upload"];
        

    }
    
    _arrowImg.image = [UIImage imageNamed:@"p_center_smrz_arrow"];
    
    if (_indexPath.row == 0) {
        _promptLab.text = @"上传持证照";
        _cardImg.image = [UIImage imageNamed:@"p_center_smrz_zjz"];
        _requirementsLab.text = @"证件上传要求如下:";
        _oneLab.text = @"1.持证正面照需本人手持证件，免冠能辨别";
        _twoLab.text = @"2.证件上信息/号码/地址需清晰可见，与填写的身份证信息一致";
        _threeLab.text = @"3.照片大小在5M以内";
    }else{
        _promptLab.text = @"上传身份证背面照";
        _cardImg.image = [UIImage imageNamed:@"p_center_smrz_bmz"];
        _requirementsLab.text = @"证件上传要求如下:";
        _oneLab.text = @"1.身份证背面需清洗拍摄有效期限位置";
        _twoLab.text = @"2.身份证有效期需一个月以上";
        _threeLab.text = @"3.照片大小在5M以内";
    }

}


@end
